<div class="page-header">
  <h1>商品検索</h1>
</div>
<?php echo validation_errors(); ?>
<form class="" action="search" method="post">
  <table class="table table-bordered">
    <colgroup>
      <col width="15%" />
      <col width="35%" />
      <col width="15%" />
      <col width="35%" />
    </colgroup>
    <tr>
      <td colspan="2" style="border-right: 0px;">&nbsp;&nbsp;検索条件</td>
      <td colspan="2" style="border-left: 0px; text-align: right;">
        <input type="button" class="" value="詳細検索" placeholder="" style="font-size: 0.8em; width: 70px;" />
      </td>
    </tr>
    <tr>
      <td>カテゴリ</td>
      <td colspan="3">
        <SELECT name='s_category'>
   			<?php foreach ($category_tree as $row_data): ?>
   				<OPTION value="<?=$row_data->category_code?>"  <?php echo isset($param['s_category'])?$param['s_category']==$row_data->category_code?'selected':'' :''; ?> >
   					<?php echo str_repeat("　", $row_data->depth) ?><?=$row_data->category_name_pc?>
   				</OPTION>
			<?php endforeach; ?>
        </SELECT>
      </td>
    </tr>
    <tr>
      <td>商品コード</td>
      <td>
        <input type="text" class="" name="s_commoditycode_from" id="s_commoditycode_from" value="<?php echo isset($param['s_commoditycode_from'])?$param['s_commoditycode_from']:''; ?>" placeholder="" /> 
        <input type="text" class="" name="s_commoditycode_to" id="s_commoditycode_to" value="<?php echo isset($param['s_commoditycode_to'])?$param['s_commoditycode_to']:''; ?>" placeholder="" />
      </td>
      <td>SKUコード</td>
      <td>
        <input type="text" class="" name="s_skucode" id="s_skucode" value="<?php echo isset($param['s_skucode'])?$param['s_skucode']:''; ?>" placeholder="" />
      </td>
    </tr>
    <tr>
      <td>商品名</td>
      <td>
        <input type="text" class="" name="s_commodityname" id="s_commodityname" value="<?php echo isset($param['s_commodityname'])?$param['s_commodityname']:''; ?>" placeholder="" />
      </td>
      <td>検索キーワード</td>
      <td>
        <input type="text" class="" name="s_keyword" id="s_keyword" value="<?php echo isset($param['s_keyword'])?$param['s_keyword']:''; ?>" placeholder="" />
      </td>
    </tr>
    <tr>
      <td>商品販売開始日</td>
      <td colspan="3">
        <input type="text" class="" name="s_sales_start_from" id="s_sales_start_from" value="<?php echo isset($param['s_sales_start_from'])?$param['s_sales_start_from']:''; ?>" /> 〜 
        <input type="text" class="" name="s_sales_start_to" id="s_sales_start_to" value="<?php echo isset($param['s_sales_start_to'])?$param['s_sales_start_to']:''; ?>" />
      </td>
    </tr>
    <tr>
      <td>商品販売終了日</td>
      <td colspan="3">
        <input type="text" class="" name="s_sales_end_from" id="s_sales_end_from" value="<?php echo isset($param['s_sales_end_from'])?$param['s_sales_end_from']:''; ?>" /> 〜 
        <input type="text" class="" name="s_sales_end_to" id="s_sales_end_to" value="<?php echo isset($param['s_sales_end_to'])?$param['s_sales_end_to']:''; ?>" />
      </td>
    </tr>
    <tr>
      <td>在庫状況</td>
      <td colspan="3">
       	<input type="radio" name="s_stock" value="1" id="s_stock1" <?php echo isset($param['s_stock'])?$param['s_stock']=='1'?'checked':'' :''; ?>>
       	<label for="s_stock1">&nbsp;あり&nbsp;&nbsp;</label>
		<input type="radio" name="s_stock" value="0" id="s_stock2" <?php echo isset($param['s_stock'])?$param['s_stock']=='0'?'checked':'' :''; ?>>
		<label for="s_stock2">&nbsp;なし&nbsp;&nbsp;</label>
      </td>
    </tr>
    <tr>
      <td>公開区分</td>
      <td><?php echo checkbox_tag('s_sale_flg','sale_flg', isset($param['s_sale_flg'])?$param['s_sale_flg']:array()) ?></td>
      <td>適用期間</td>
      <td>
        <input type="checkbox" name="ss_sale_flg[]" value="1"> 公開中 <input type="checkbox" name="ss_sale_flg[]" value="0"> 非公開中
      </td>
    </tr>
  </table>
  <table style="border: 0px; width: 100%;">
    <colgroup>
      <col width="100%" />
    </colgroup>
    <tr>
      <td align="right">
        <button type="submit" class="btn btn-default" style="width: 120px;">検索</button>
      </td>
    </tr>
  </table>
</form>
<br />

<div class="bs-example" data-example-id="striped-table">
  <table class="table table-bordered">
    <colgroup>
      <col width="2%" />
      <col width="8%" />
      <col width="10%" />
      <col width="35%" />
      <col width="10%" />
      <col width="10%" />
      <col width="19%" />
      <col width="6%" />
    </colgroup>
    <thead>
      <tr>
        <th></th>
        <th></th>
        <th>商品コード</th>
        <th>商品名</th>
        <th>販売価格<br />在庫
        </th>
        <th>公開区分<br />適用期間
        </th>
        <th>関連付け</th>
        <th></th>
      </tr>
    </thead>
	<?php
	if(isset($list)){
		
	
	foreach ( $list as $entry ) {
		?>
      <tbody>
      <tr>
        <th scope="row">1</th>
        <td></td>
        <td><?=$entry->commodity_code?></td>
        <td>
          <a href="/zswebshop/index.php/admin/commodity/commodity_edit/select/<?=$entry->commodity_code?>"><?=$entry->commodity_name?></a>
        </td>
        <td><?=number_format($entry->unit_price)?>円</td>
        <td><?=$entry->sale_flg?></td>
        <td></td>
        <td>
          <a href="/zswebshop/index.php/admin/commodity/commodity_edit/copy/<?=$entry->commodity_code?>">コピー</a>
        </td>
      </tr>
    </tbody>
	<?php
	}
	}
	?>
    </table>
</div>
<!-- /example -->
